package leetcode.weekly.week306;

//Solution1Test
public class Solution1 {

	public int[][] largestLocal(int[][] grid) {
		int n = grid.length;
		int[][] ans = new int[n - 2][n - 2];
		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < n - 1; j++) {
				int max = 0;
				for (int m = -1; m <= 1; m++) {
					for (int k = -1; k <= 1; k++) {
						max = Math.max(grid[i + m][j + k], max);
					}
				}
				ans[i - 1][j - 1] = max;
			}
		}
		return ans;

	}
}
